﻿//Copyright 2010 http://tv4home.codeplex.com
//This file is part of TV4Home.Server.TVEInteractionLibrary.Interfaces.
//TV4Home.Server.TVEInteractionLibrary.Interfaces is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
//TV4Home.Server.TVEInteractionLibrary.Interfaces is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//You should have received a copy of the GNU Lesser General Public License along with TV4Home.Server.TVEInteractionLibrary.Interfaces. If not, see http://www.gnu.org/licenses/
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TV4Home.Server.TVEInteractionLibrary.Interfaces
{
    [ServiceContract(Namespace = "http://tv4home.codeplex.com")]
    public interface ITVEInteraction
    {
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        string SayHello();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        bool TestConnectionToTVService();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void AddSchedule(int channelId, string title, DateTime startTime, DateTime endTime, int scheduleType);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void AddScheduleDetailed(int channelId, string title, DateTime startTime, DateTime endTime, int scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebVirtualCard SwitchTVServerToChannelAndGetVirtualCard(string userName, int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        string SwitchTVServerToChannelAndGetStreamingUrl(string userName, int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        string SwitchTVServerToChannelAndGetTimeshiftFilename(string userName, int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void SendHeartbeat(string userName);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        bool CancelCurrentTimeShifting(string userName);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebChannelDetailed> GetChannelsDetailed(int groupId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebChannelDetailed> GetChannelsDetailedByRange(int groupId, int startIndex, int count);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebChannelBasic> GetChannelsBasic(int groupId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebChannelBasic> GetChannelsBasicByRange(int groupId, int startIndex, int count);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        int GetChannelCount(int groupId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebRecording> GetRecordings();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebSchedule> GetSchedules();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebChannelDetailed GetChannelDetailedById(int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebChannelBasic GetChannelBasicById(int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebProgramDetailed GetProgramDetailedById(int programId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebProgramBasic GetProgramBasicById(int programId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebProgramDetailed> GetProgramsDetailedForChannel(int channelId, DateTime startTime, DateTime endTime);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebProgramBasic> GetProgramsBasicForChannel(int channelId, DateTime startTime, DateTime endTime);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        bool GetProgramIsScheduledOnChannel(int channelId, int programId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        bool GetProgramIsScheduled(int programId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebProgramDetailed> SearchProgramsDetailed(string searchTerm);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebProgramBasic> SearchProgramsBasic(string searchTerm);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebChannelGroup> GetGroups();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebChannelGroup GetGroupById(int groupId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void CancelSchedule(int programId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void DeleteSchedule(int scheduleId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebCard> GetCards();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebVirtualCard> GetActiveCards();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebRtspClient> GetStreamingClients();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        List<WebUser> GetActiveUsers();

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebProgramDetailed GetCurrentProgramOnChannel(int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        WebProgramDetailed GetNextProgramOnChannel(int channelId);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        string ReadSettingFromDatabase(string tagName);

        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        void WriteSettingToDatabase(string tagName, string value);
    }
}
